from apscheduler.schedulers.background import BackgroundScheduler
from loguru import logger

from apis_module.task.look_tasks import update_look_reviews_cache_task

scheduler = BackgroundScheduler()


def start_scheduler():
    scheduler.add_job(func=update_look_reviews_cache_task(), trigger='cron', id='update_look_reviews_cache_task',
                      hour="0", minute="0", second="0")
    scheduler.start()
    logger.info("Scheduler started")


def stop_scheduler():
    scheduler.shutdown()
    logger.info("Scheduler stopped")
